// pages/myfocus/myfocus.js
var util = require("../../utils/util.js")
var api = require("../../utils/api.js")
var app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        oType: 1,
        userid: '',
        type: 'consult',
        page: 0,
		user_map:{},
		user_map1:{}
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
		var that = this;
		wx.getStorage({
			key: 'userInfo',
			success: function (res) {
				that.setData({
					userid: res.data.id,
				})
				var data = {
					id: that.data.userid,
					type: that.data.type,
				}
				var url = app.u.HOME_URL + app.u.ME_GETMARK
				api.requestUrl(data, url).then(res => {
					that.setData({
						user_map: res.data
					})
				})
			},
		})
    },
    tableCheck: function(e) {
        var that = this;
        that.setData({
            oType: 1,
            type: 'consult',
        })
		var data = {
			id: that.data.userid,
			type: that.data.type,
		}
		var url = app.u.HOME_URL + app.u.ME_GETMARK
		api.requestUrl(data, url).then(res => {
			that.setData({
				user_map: res.data
			})
		})
    },
    tableCheck1: function(e) {
        var that = this;
        that.setData({
            oType: 2,
            type: 'org',
        })
		var data = {
			id: that.data.userid,
			type: that.data.type,
		}
		var url = app.u.HOME_URL + app.u.ME_GETMARK
		api.requestUrl(data, url).then(res => {
			that.setData({
				user_map1: res.data
			})
		})
    },  
    consultant:function(e){
       wx.navigateTo({
		   url: '../development/development?id=' + e.currentTarget.dataset.id,
	   })
	},
	institutions:function(e){
		wx.navigateTo({
			url: '../instdetails/instdetails?id=' + e.currentTarget.dataset.id
		})
	},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {
        wx.showShareMenu({
            withShareTicket: true
        })
		
    },
    // onReachBottom: function() {
    //     let that = this
    //     let newpage = that.data.page + 1
    //     var data = {
    //         id: that.data.userid,
    //         type: that.data.type,
    //         page: newpage,
    //     }
    //     var url = app.u.HOME_URL + app.u.ME_GETMARK
    //     api.requestUrl(data, url).then(res => {
    //         page: newpage
    //     })
    // }
})